/**
 * Created by Administrator on 2017/1/21.
 */

var MJ = require('../MJ/MJ');

exports.PiaoStatus = {
    'NONE': 0,
    'FINISHED': 1,
}

exports.OptionRule = {
    'NORMAL': 1,    // 推倒胡
    'XFG': 2,       // 旋风杠
    'XJFD': 3,      // 小鸡飞蛋
}

/**
 * 特殊杠
 * @type {{}}
 */
var SpecGang = {
    'NORMAL': 0,
    'SF': 1,  // 四风杠
    'XI': 2,  // 喜杠
    'YD': 3,  // 幺蛋
    'JD':4,   // 九蛋
    'DD':5,   // 大蛋
}

var SpecGangScore = {};
SpecGangScore[SpecGang.SF] = 4;
SpecGangScore[SpecGang.XI] = 2;
SpecGangScore[SpecGang.YD] = 2;
SpecGangScore[SpecGang.JD] = 2;
SpecGangScore[SpecGang.DD] = 4;

var ScoreRule = clone(MJ.ScoreRule);
ScoreRule.JiaHu = 201;          // 夹胡
ScoreRule.MenQing = 202;        // 门清
ScoreRule.SiGuiYi = 203;        // 四归一
ScoreRule.ShouBaYi =  204;      // 手把一
ScoreRule.YiBanGao =  205;      // 一般高
ScoreRule.HunYiSe =  206;       // 混一色
ScoreRule.QingYiSe =  207;      // 清一色
ScoreRule.SanJiaQing =  208;    // 三家清
ScoreRule.SiJiaQing =  209;     // 四家清

var Pattern = {
    'NONE': 0,                // 不是可胡的牌型
    'NORMAL': MJ.Pattern.NORMAL,              // 平胡
    'PAIR': MJ.Pattern.PAIR,                   // 对对胡
    'PAIR7': MJ.Pattern.PAIR7,                // 七对
    'ONE13': 9,               // 13幺
};

var PatternScore = {}
PatternScore[Pattern.NORMAL] = 0;
PatternScore[Pattern.PAIR] = 1;
PatternScore[Pattern.PAIR7] = 3;
PatternScore[Pattern.ONE13] = 7;

var ItemScore = {};
ItemScore[ScoreRule.DH] = 1;
ItemScore[ScoreRule.ZM] = 1;
ItemScore[ScoreRule.LZ] = 1;
ItemScore[ScoreRule.GSH] = 1;
ItemScore[ScoreRule.GSP] = 1;
ItemScore[ScoreRule.QG] = 0;
ItemScore[ScoreRule.BT] = 1;
ItemScore[ScoreRule.TH] = 0;
ItemScore[ScoreRule.DIHU] = 0;
ItemScore[ScoreRule.TT] = 0;


ItemScore[ScoreRule.JiaHu] = 1;
ItemScore[ScoreRule.MenQing] = 1;
ItemScore[ScoreRule.SiGuiYi] = 1;
ItemScore[ScoreRule.ShouBaYi] = 1;
ItemScore[ScoreRule.YiBanGao] = 1;
ItemScore[ScoreRule.HunYiSe] = 1;
ItemScore[ScoreRule.QingYiSe] = 3;
ItemScore[ScoreRule.SanJiaQing] = 2;
ItemScore[ScoreRule.SiJiaQing] = 3;

var ScoreReason = {
    DH: MJ.Result.DH,  // 点胡/点炮
    ZM: MJ.Result.ZM,  // 自摸/被自摸
    PIAO: 301,          // 飘

    BT: ScoreRule.BT, // 报听
    LZ: ScoreRule.LZ, // 庄家
    QG: ScoreRule.QG, // 抢杠
};

var GangScore = {};
GangScore[MJ.Gang.BA] = 2;
GangScore[MJ.Gang.AN] = 4;
GangScore[MJ.Gang.DIAN] = 2;
GangScore[MJ.Gang.ANS] = 4;

exports.ScoreRule = ScoreRule;
exports.Pattern = Pattern;
exports.PatternScore = PatternScore;
exports.ItemScore = ItemScore;
exports.ScoreReason = ScoreReason;
exports.GangScore = GangScore;

exports.SpecGang = SpecGang;
exports.SpecGangScore = SpecGangScore;